interface Rect {
    x: number,
    y: number,
    w: number,
    h: number,
    left: number,
    top: number
}

export const splitArray = (data: Array<any>, num?: number = 4) => {
    const result = [];
    for (let i = 0, len = data.length; i < len; i += num) {
        const _res = data.slice(i, i + num);
        result.push(_res);
    }
    return result;
}

export const getRect = (el: any): Promise<Rect> => (
    new Promise(resolve => {
        el.measure((
            x, y, w, h, left, top
        ) => (
            resolve({
                x, y, w, h, left, top
            })
        ))
    })
)